<script setup>
import { inject } from 'vue';


// 接收(注入)爷爷传过来的数据
const money = inject('money')
const payMoney = inject('payMoney')
</script>

<template>
  <div class="sun">
    <p>爷爷的钱包: {{ money }}</p>
    <button @click="payMoney(100)">花钱</button>
  </div>
</template>

<style scoped>
.sun {
  width: 200px;
  height: 200px;
  border: 10px solid blue;
  margin: 10px;
}
</style>
